<extend name="Index:base" />
<block name="title"><title>管理组</title></block>
<block name="style">
 <style>
.main,.panel-default>.panel-heading{
background:none;
}

body{
background:none;
}
.panel.panel-default,.panel .panel-body,.panel .panel-heading,.table-bordered {
	border:none;
}
.table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
	border:none;		
	padding:15px;	
	line-height:8px;
	height: 8px;
	border-top: 1px solid #d4d4d4;
	border-bottom: 1px solid #d4d4d4;
}
.name strong{
color:#000000;
font-size:15px;
font-weight:600;
}
.name {
	color:#20a8d8;
	font-size:12px;
}
.smallfont {
	color:#9c9c9c;
	font-size:12px;
}

.align-center{
	text-align:center; 
}
.title2{
text-align:center;
}
.table-bordered > tbody > tr .wd{
	text-align:left;	
}

.col-xs-2,.col-xs-4{
padding-right:0;
margin:10px 0;
}
 </style>
</block>
	<!-- start: Header -->
<block name="body">

			<!-- end: Main Menu -->
						
		<!-- start: Content -->
		<div class="main ">
		
			<div class="row">
				<div class="col-lg-12">
					<h3 class="page-header"><i class="fa fa-life-bouy"></i>管理组</h3>
				</div>
			</div>

			<div class="row">		
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h2><span class="break"></span><strong>管理组</strong></h2>&nbsp;&nbsp;&nbsp;
							<a class="btn btn-success" role="button" data-toggle="modal" href="#again" id="add_right">添加管理组</i></a>							
						</div>&nbsp;&nbsp;&nbsp;
						<ol class="breadcrumb" style="height:55px;background-color: #ffffff;">							
							<li><i class="fa fa-warning"></i><a href="#">操作提示：</a></li><br/>	
							<li><font style="font-size:8px;color:#888;">通过会员管理，你可以进行查看、编辑会员资料等操作
							你可以根据条件搜索会员，然后选择相应的操作！</font></li>							
						</ol>
						<div class="panel-body">
							<table class="table table-striped table-bordered bootstrap-datatable datatable">
							  <thead>
								  <tr>
									  <th></th>
                                      <th>管理组名称</th>
									  <th class="title2">更新时间</th>
									  <th class="title2">管理组权限</th>
									  <th class="title2">操作</th>
								  </tr>
							  </thead>   
							  <tbody id="state">
								<volist name="list" id="vo">
								<tr>
									<td></td>
									 <td class="wd">{$vo.gname}</td>
									<td class="align-center">
										{$vo.updatetime|date='Y-m-d',###}
									</td>
									<td class="align-center">
									<if condition="$vo.gr_status eq '1'">普通管理员</if>
									<if condition="$vo.gr_status eq '2'">超级管理员</if>
									<if condition="$vo.gr_status eq '0'">无任何权限</if>
									</td>
									<td class="align-center">
										<eq name="gr_status" value="2">
										<if condition="$vo.gr_status neq '2'">
										<a class="label label-primary" role="button" data-toggle="modal" href="#edit" data-id="{$vo.id}" data-type="edit_group" data-name="{$vo.gname}">修改</i>
										</a>&nbsp;
										
										<a class="label label-primary" href="{:U('Admin/pow_set')}?atc=set&id={$vo.id}" >编辑权限</i></a>										
										<a href="javascript:;" data-id="{$vo.id}" data-type="del_group">			
										&nbsp;
										<span class="label label-danger" data-status="3" >删除</span>
										</a>
										<else/>
										<a class="label label-primary" href="{:U('Admin/pow_set')}?atc=set&id={$vo.id}" >查看权限</i></a>
										</if>
										</eq>
										<eq name="gr_status" value="1">
											<a class="label label-primary" href="{:U('Admin/pow_set')}?atc=set&id={$vo.id}" >查看权限</i></a>
										</eq>
																		
									 </td>

								</tr>
								</volist>
							  </tbody>
						  </table>  
							<ul class="pagination">
								{$page}
							 </ul>						  
						</div>
					</div>
				</div><!--/col-->
			
			</div><!--/row-->				
			
		<!-- end: Content -->
		<br><br><br>
		
	</div><!--/container-->
<!--添加新会员-->	
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="again" class="modal fade add_right">
		
            <div class="modal-dialog public-top"  id="">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="title">添加管理组</h4>
                    </div>
					<form action="{:U('Admin/group_updata')}" method="post" class="form-horizontal" id="action">
						<div class="modal-body">
							<label class="">管理组名称:</label>
							<div class="">
								<input type="text" id="group_name" name="group_name" value="" class="form-control placeholder-no-fix" >
							</div></br>
						</div></br>
						<input type="hidden"  name="id" id="id" value="">
						<input type="hidden"  name="type" id="type" value="add_group">
						<div class="modal-footer">
							<button data-dismiss="modal" class="btn btn-default" type="button">关闭</button>
							<button class="btn btn-primary mypost" type="sunmit">确认</button>
						</div>
					</form>	
              </div>
            </div>
        </div>		
</block>
<block name="script">
<script>
$("#add_right").click(function(){
	$(".add_right").attr('id','again');
	$("#title").html('添加管理组');
	$("#id").val('');
	$("#group_name").val('');
	$("#type").val('add_group');
});


$("[data-type='edit_group']").click(function(){
	
    var id = $(this).attr('data-id');
	var state = $(this).find('span').attr('data-status');
	
	var type = $(this).attr('data-type');
	var group_name = $(this).attr('data-name');
	
	if (id && type) {
		$(".add_right").attr('id','edit');
		$("#title").html('修改管理组');
		$("#group_name").val(group_name);
		$("#id").val(id);
		$("#type").val('edit_group');	
		//alert(gname);		
	}

});

$("[data-type='del_group']").click(function(){
	
    var id = $(this).attr('data-id');
	var state = $(this).find('span').attr('data-status');
	
	var type = $(this).attr('data-type');
	
	if (id && type) {
		if(confirm("确定要删除吗？")){	
			$.ajax({
				url:"{:U('Admin/group_updata')}",
				data:{id:id,state:state,type:type},
				type:'post',
				dataType:'json',
				success:function (e) {			
				//alert(e.info);
					if (e.info==1) {
						alert('删除成功');
						location.reload();
					} else if(e.info==4){
						alert('删除失败');
					} 
				
				}
			});	
		}
	}  

});
</script>
</block>	









